package com.katarina.ad.service;

import java.util.List;

import com.katarina.ad.domain.Product;

public class SimpleProductManager implements ProductManager {

  private static final long serialVersionUID = 1325757060395851253L;
  private List<Product> products;

  @Override
  public List<Product> getProducts() {
    return products;
  }

  @Override
  public void increasePrice(int percentage) {
    if (products != null) {
      for (Product product : products) {
        double newPrice = product.getPrice().doubleValue() * (100 + percentage) / 100;
        product.setPrice(newPrice);
      }
    }

  }

  public void setProducts(List<Product> products) {
    this.products = products;
  }

}